let href = location.href;

function getUrlParams(url) {
   
    let reg = /^[^\s]+\?([^&\s\d]+=[^\s]+)*/
    let match = reg.exec(url)
    match = match[1]
    if (!match) {
        console.warn("没有匹配到相应的query参数")
        return null
    }
   
    let queryString = decodeURI(match);
   
    let queryArr = queryString.split("&");
   
    let queryParamsObj = {}
    queryArr.forEach(item => {
        let itemArr = item.split("=")
        queryParamsObj[itemArr[0]] = itemArr[1]
    })
   
    return queryParamsObj
}
let qr = getUrlParams(href)
console.log(qr);
let { productid } = qr;


$.ajax({
    url: "http://chst.vip:1234/api/getmoneyctrlproduct",
    data: {
        productid
    }
})
    .then(res => {
        console.log(res);
        
        let { result: [info] } = res;
        console.log(info);

        let html = `
        <h4 class="title">
            ${info.productName}
        </h4>
        
        <p>
        <span>${info.productFrom}</span><i>|</i>
        <span>${info.productTime}</span>
        <b>${info.productTips}</b>
        </p>
        
        <h3 class="detail">
        <div class="iconImg">${info.productImgSm}</div>
            ${info.productInfo}
            ${info.productInfo1}
            ${info.productInfo2}
        </h3>
        <div class="bigImg">${info.productImg2}</div>
        <ul>${info.productCity}</ul>
        `;

        $(".container").html(html);
        let comments=`
                ${info.productComment}
        `;
        $(".comments").html(comments);

    })